package com.woniu.learnexception.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.method.HandlerMethod;

/**
 * created  by woniu201
 * created in 2020/3/27
 */
//@ControllerAdvice
public class ErrorControllerAdvice {

    @ExceptionHandler(Exception.class)
    public void handlerError(Exception ex, HandlerMethod handlerMethod){
        System.out.println("统一异常处理");
        System.out.println(ex.getMessage());
        System.out.println(handlerMethod.getBean().getClass());
        System.out.println(handlerMethod.getMethod().getName());
    }
}
